package com.zut.yyzx.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zut.yyzx.pojo.Bed;
import com.zut.yyzx.service.BedService;
import com.zut.yyzx.utils.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/bed")
//"床位管理"
@CrossOrigin
public class BedController {

    @Autowired
    private BedService bedService;
    @GetMapping("/findBed")
    //"查询床位信息"
    public ResultVo<List<Bed>> findBed(Bed bed){
        QueryWrapper qw=new QueryWrapper();
        if(bed.getRoomNo()!=null){
            qw.eq("room_no",bed.getRoomNo());
        }
        if(bed.getBedStatus() !=null){
            qw.eq("bed_status",bed.getBedStatus());
        }
        return ResultVo.ok(bedService.list(qw)) ;
    }
}
